import trees
import treePlotter
import bayes

myData, labels = trees.craateDataSet()
#print(trees.calcShannonEnt(myData))
#res = trees.splitDateSet(myData, 0, 1)
#print(res)
#res = trees.chooseBestFeatureToSplit(myData)
print("==============source======================")
print(myData)
print("==============best split 0======================")
#print(trees.splitDateSet(myData, res, 0));
print("==============best split 1======================")
#print(trees.splitDateSet(myData, res, 1));
fr=open('lenses.data')
lenses=[inst.strip().split('\t') for inst in fr.readline()]
lensesLabels =['age', 'prescript', 'astigmatic', 'tearRate']
lenseTree = treePlotter.retriveTree(0);#trees.createTree(myData, labels)
print("==============lenseTree======================")
print(lenses)
i=treePlotter.getNumLeafs(lenseTree)
j=treePlotter.getTreeeDepth(lenseTree)
#treePlotter.createPlot(lenseTree)
print("==============bayes======================")
listOposts, listClasses = bayes.loadDataSet()
print(listOposts)
print(listClasses)
myVocabList = bayes.createVocabList(listOposts)
print(myVocabList)
